<?php
namespace app\content\controller;
use think\admin\Controller;
use app\index\model\Banner as BannerModel;
use app\index\model\DataUser;
use app\model\Cassette as ModelCassette;
use app\model\Merchant;;
use app\model\MerchantCate;
use think\admin\helper\QueryHelper;

class Cassette  extends Controller{

     /**
     * @auth true
     * @menu true
     */
    public function index(){
        $search = input('get.');
        ModelCassette::mQuery()->layTable(function () {
            $this->title = '卡座列表';
            $this->merchant_list = Merchant::where('status',1)->select();
        }, function (QueryHelper $query) use ($search) {
            // 数据列表搜索过滤
            $query->with('merchant')->like('name')->equal('mid');
        });
    }

     /**
     * @auth true
     * @menu true
     */
    public function edit()
    {
        $this->title = '编辑';
        $this->merchant_list = Merchant::where('status',1)->select();
        // MyModel::mForm('form');
        $this->_form('cassette','form');
    }

     /**
     * @auth true
     * @menu true
     */
    public function add()
    {
        $this->title = '添加';
        $this->merchant_list = Merchant::where('status',1)->select();
        $this->_form('cassette','form');
    }

    public function remove()
    {
        $this->_delete('cassette');
    }


    public function state()
    {
     
        ModelCassette::mSave($this->_vali([
            'status.in:0,1'  => '状态值范围异常！',
            'status.require' => '状态值不能为空！',
        ]));
    }
}